package com.kgc.storeconsumer.controller;

import com.kgc.basic.util.ResponseMsg;
import com.kgc.store.pojo.InStoreDetail;
import com.kgc.storeconsumer.feign.InStoreDetailFeign;
import com.kgc.storeconsumer.feign.InStoreFeign;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@Controller
@CrossOrigin("*")
@RequestMapping("/inStoreDetail")
public class InStoreDetailController {
    private Logger logger = LoggerFactory.getLogger(getClass());
    @Autowired
    private InStoreDetailFeign inStoreDetailFeign;

    @RequestMapping("getInStoreDetailList")
    @ResponseBody
    public ResponseMsg getInStoreDetailList(String inStoreCode){
        logger.info("InStoreDetailController getInStoreDetailList inStoreCode:"+inStoreCode);
        ResponseMsg msg =inStoreDetailFeign.getInStoreDetailList(inStoreCode);
        logger.debug("InStoreDetailController getInStoreDetailList inStoreCode:"+inStoreCode);
        return msg;
    }


    @RequestMapping("delInStoreDetail")
    @ResponseBody
    public ResponseMsg delInStoreDetail(Integer id){
        logger.info("InStoreDetailController delInStoreDetail id:"+id);
        ResponseMsg msg =inStoreDetailFeign.delInStoreDetail(id);
        logger.debug("InStoreDetailController delInStoreDetail id:"+id);
        return msg;
    }

    @RequestMapping("addInStoreDetail")
    @ResponseBody
    public ResponseMsg addInStoreDetail(@RequestBody InStoreDetail inStoreDetail){
        logger.info("InStoreDetailController addInStoreDetail inStoreDetail:"+inStoreDetail);
        ResponseMsg msg =inStoreDetailFeign.addInStoreDetail(inStoreDetail);
        logger.debug("InStoreDetailController addInStoreDetail inStoreDetail:"+inStoreDetail);
        return msg;
    }
}
